package com.shortlink.admin.remote;

import com.shortlink.admin.remote.dto.shortlinkmapper.ShortLinkMapperInsertReqDTO;
import com.shortlink.admin.remote.dto.shortlinkmapper.ShortLinkMapperUpdateReqDTO;
import com.shortlink.common.base.Result;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 链接跳转远程服务
 *
 * @author wp
 */
@FeignClient(
        name = "${shortlink-aggregation.name:shortlink-core}",
        path = "/${shortlink-aggregation.name:shortlink-core}",
        contextId = "shortLinkMapper"
)
public interface ShortLinkMapperRemoteService {
    @PostMapping("/api/shortlink-mappers")
    Result<Void> insert(@RequestBody ShortLinkMapperInsertReqDTO shortLinkMapperInsert);

    @PostMapping("/api/shortlink-mappers/save/batch")
    Result<Void> batchInsert(@RequestBody List<ShortLinkMapperInsertReqDTO> shortLinkMapperInserts);

    @PutMapping("/api/shortlink-mappers")
    Result<Void> update(@RequestBody ShortLinkMapperUpdateReqDTO shortLinkMapperUpdate);

    @DeleteMapping("/api/shortlink-mappers/{id}")
    Result<Void> moveToRecycleBin(@PathVariable("id") Long id);

    @DeleteMapping("/api/shortlink-mappers/delete/actual/{id}")
    Result<Void> delete(@PathVariable("id") Long id);

    @PutMapping("/api/shortlink-mappers/recover/{id}")
    Result<Void> recover(@PathVariable("id") Long id);
}
